<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>代办任务-详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui-v2.5.4/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
    <style>
        .layui-form-item .layui-input-company {
            width: auto;
            padding-right: 10px;
            line-height: 38px;
        }
    </style>
</head>
<body>
<div class="layuimini-container">
    <fieldset class="layui-elem-field layuimini-search">
        <legend>
             <span class="layui-breadcrumb" lay-separator=">">
                  <a href="/admin/workflow/task/list">代办任务</a>
                  <a><cite>审批</cite></a>
            </span>
        </legend>
        <div style="margin: 10px 10px 10px 10px">
            <form class="layui-form layui-form-pane" action="">
                <div class="layui-form-item">
                    <div class="layui-inline" style="float: right">
                        <a href="/admin/workflow/task/list" class="layui-btn">返回</a>
                    </div>
                </div>
            </form>
        </div>
    </fieldset>
    <div class="layuimini-main">
        <div class="layui-form layuimini-form">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>流程信息</legend>
            </fieldset>
            <div class="layui-container">
                <div class="layui-row">
                    <div class="layui-form-item">
                        <div class="layui-col-xs2">申请人</div>
                        <div class="layui-col-xs8" th:text="${licenseEvent.accountName}"></div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-col-xs2">申请事项</div>
                        <div class="layui-col-xs8" th:text="${licenseEvent.licenseName}"></div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-col-xs2">申请时间</div>
                        <div class="layui-col-xs8"
                             th:text="${licenseEvent.startTime != null ? #dates.format(licenseEvent.startTime,'yyyy-MM-dd') : ''}"></div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-col-xs2">审批状态</div>
                        <div class="layui-col-xs8" th:text="${licenseEvent.statusName}"></div>
                    </div>
                </div>
            </div>
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>申请信息</legend>
            </fieldset>
            <div class="layui-container">
                <div class="layui-row">
                    <div class="layui-form-item">
                        <div class="layui-col-xs2">开始时间</div>
                        <div class="layui-col-xs8"
                             th:text="${licenseForm.startTime != null ? #dates.format(licenseForm.startTime,'yyyy-MM-dd') : ''}"></div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-col-xs2">结束时间</div>
                        <div class="layui-col-xs8"
                             th:text="${licenseForm.endTime != null ? #dates.format(licenseForm.endTime,'yyyy-MM-dd') : ''}"></div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-col-xs2">备注</div>
                        <div class="layui-col-xs8" th:text="${licenseForm.note}"></div>
                    </div>
                </div>
            </div>
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>审批信息</legend>
            </fieldset>
            <div class="layui-container">
                <div class="layui-row">
                    <div class="layui-col-xs2 layui-col-md-offset3">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="pass">通过</button>
                        </div>
                    </div>
                    <div class="layui-col-xs2">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="reject">驳回</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/lib/layui-v2.5.4/layui.js" charset="utf-8"></script>
<script th:inline="javascript">
    /*<![CDATA[*/
    var processId = [[${licenseEvent.workFlowId}]];
    var eventId = [[${licenseEvent.id}]];

    layui.use(['form', 'element'], function () {
        var $ = layui.jquery,
            form = layui.form,
            element = layui.element;

        //通过
        form.on('submit(pass)', function (param) {
            var param = {
                "eventId": eventId,
                "processId": processId,
                "opinion": true
            }
            $.ajax({
                url: "/api/admin/workflow/confirm/approve",
                type: "POST",
                data: param,
                success: function (rst) {
                    layer.msg(rst.msg);
                    if (rst.code === '1') {
                        setTimeout(function () {
                            location.href = "/admin/workflow/task/list";
                        }, 2000);
                    }
                }
            });
            return false;
        });
        // 驳回
        form.on('submit(reject)', function (param) {
            var param = {
                "eventId": eventId,
                "processId": processId,
                "opinion": false
            }
            $.ajax({
                url: "/api/admin/workflow/confirm/approve",
                type: "POST",
                data: param,
                success: function (rst) {
                    layer.msg(rst.msg);
                    if (rst.code === '1') {
                        setTimeout(function () {
                            location.href = "/admin/workflow/task/list";
                        }, 2000);
                    }
                }
            });
            return false;
        });
    });
    /*]]>*/
</script>
</body>
</html>